import { CoolController, BaseController } from '@cool-midway/core';
import { Get, Inject, Query } from '@midwayjs/core';
import { CountHomeService } from '../../service/home';

/**
 * 首页统计
 */
@CoolController()
export class AdminCountHomeController extends BaseController {
  @Inject()
  countHomeService: CountHomeService;

  @Get('/top', { summary: '顶部统计' })
  async top() {
    return this.ok(await this.countHomeService.top());
  }

  @Get('/chart', { summary: '图表统计' })
  async chart(@Query('dayCount') dayCount: number) {
    return this.ok(await this.countHomeService.chart(dayCount));
  }
}
